package com.treasure.mall.biz.repository.integral;

import com.treasure.mall.biz.base.JpaSearchableRepository;
import com.treasure.mall.biz.entity.integral.IntegralOrderPO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/8/22
 */
@Repository
public interface IntegralOrderRepository extends JpaSearchableRepository<IntegralOrderPO, String> {
    @Query("select coalesce(sum(po.num),0) from IntegralOrderPO po where po.userPO.userId=?1")
    int userBuyCount(Long userId);
}
